﻿using System;
using Castle.ActiveRecord;

namespace Hadlow.Jobvertizer.Models
{
    [ActiveRecord]
    public class PosterUser : Entity
    {
        Poster poster;

        [BelongsTo("PosterId")]
        public Poster Poster
        {
            get { return poster; }
            set { poster = value; }
        }

        User user;

        [BelongsTo("UserId")]
        public User User
        {
            get { return user; }
            set { user = value; }
        }

        public override string ToString()
        {
            if (user == null)
            {
                return base.ToString();
            }
            return user.Name;
        }
    }
}
